/**
 * 
 */
package com.lastproject.web.bean;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import javax.faces.model.ArrayDataModel;
import javax.faces.model.DataModel;

import com.lastproject.dto.SearchUserDTO;

/**
 * @author Alexandra
 * 
 */
@ManagedBean
@RequestScoped
public class SearchUserTableData {

	private DataModel<SearchUserDTO> filterModel = null;

	@ManagedProperty(value = "#{searchUserBean}")
	private SearchUserBean searchUserBean;

	private SearchUserDTO[] foundUserArr;

	@PostConstruct
	public void postConstr() {

		try {

			foundUserArr = new SearchUserDTO[searchUserBean
					.getSearchUserDTOList().length];

			for (int i = 0; i < searchUserBean.getSearchUserDTOList().length; i++) {
//				System.out.println("SearchUserTableData "
//						+ searchUserBean.getSearchUserDTOList()[i]
//								.getLastname()
//						+ " "
//						+ searchUserBean.getSearchUserDTOList()[i]
//								.getFirstname());
			}

			for (int i = 0; i < searchUserBean.getSearchUserDTOList().length; i++) {
				foundUserArr[i] = searchUserBean.getSearchUserDTOList()[i];
			}
		} catch (NullPointerException e) {

		}
		filterModel = new ArrayDataModel<SearchUserDTO>(foundUserArr);
	}

	public SearchUserTableData() {

	}

	public DataModel<SearchUserDTO> getSurveysList() {
		return filterModel;
	}

	public SearchUserDTO[] getFoundUserArr() {
		return foundUserArr;
	}

	public void setFoundUserArr(SearchUserDTO[] foundUserArr) {
		this.foundUserArr = foundUserArr;
	}

	public SearchUserBean getSearchUserBean() {
		return searchUserBean;
	}

	public void setSearchUserBean(SearchUserBean searchUserBean) {
		this.searchUserBean = searchUserBean;
	}

}
